package com.iqiyi.pps.epg.core.model.carousel;


import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Lemuel on 2015/6/5.
 */
@Entity
@Table(name = "carousel_episode_rule")
@Cache(usage = CacheConcurrencyStrategy.NONE)
public class CarouselBase {

    public static final long DEFAULT_COPYRIGHT_END_TIME = 0;
    public static final String DEFAULT_COPYRIGHT_END_TIME_FORMAT = "0000-00-00 00:00:00";

    public static final int DEFAULT_STATUS = 1;
    public static final int ILLEGAL_STATUS = 0;
    public static final int DEL_STATUS = -1;
    //    public static final int DEFAULT_CREATE_DAYS = 10;
    public static final int DEFAULT_LAST_CREATED_NO = 0;
    public static final long DEFAULT_LAST_CREATED_QIPUID = new Long(0);

    private Long id;
    private Long fatherId;
    private Long qipuId;
    private String showName;
    private Timestamp startTime;
    private Timestamp endTime;
    private int itemTime;
    private int startNum;
    private int followNum;
    private int totalNum;
    private int repeatedStatus;
    private int followedStatus;
    private String channelTag;
    private Long copyrightEndTime;
    private int bossStatus;
    private int publishStatus;
    private Timestamp createdTime;
    private String opUser;
    private int status;
    private String pageUrl;
    private Timestamp extendTime;
    private int actualNum;

    private int lastCreatedNo;
    private long lastCreatedQipuId;

    private int errorCount;

    private boolean needUpdate = false;

    public static final Integer STATUS_NORMAL = 1;
    public static final Integer STATUS_DELETE = -1;
    public static final Integer FOLLOW_STATUS_YES = 1;//跟播
    public static final Integer FOLLOW_STATUS_NO = 2;//不跟播
    public static final Integer REPEAT_STATUS_YES = 1;//循环
    public static final Integer REPEAT_STATUS_NO = 2;//不循环


    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "father_id")
    public Long getFatherId() {
        return fatherId;
    }

    public void setFatherId(Long fatherId) {
        this.fatherId = fatherId;
    }

    @Column(name = "qipu_id")
    public Long getQipuId() {
        return qipuId;
    }

    public void setQipuId(Long qipuId) {
        this.qipuId = qipuId;
    }

    @Column(name = "show_name")
    public String getShowName() {
        return showName;
    }

    public void setShowName(String showName) {
        this.showName = showName;
    }

    @Column(name = "start_time")
    public Timestamp getStartTime() {
        return startTime;
    }

    public void setStartTime(Timestamp startTime) {
        this.startTime = startTime;
    }

    @Column(name = "end_time")
    public Timestamp getEndTime() {
        return endTime;
    }

    public void setEndTime(Timestamp endTime) {
        this.endTime = endTime;
    }

    @Column(name = "item_time")
    public int getItemTime() {
        return itemTime;
    }

    public void setItemTime(int itemTime) {
        this.itemTime = itemTime;
    }

    @Column(name = "start_num")
    public int getStartNum() {
        return startNum;
    }

    public void setStartNum(int startNum) {
        this.startNum = startNum;
    }

    @Column(name = "follow_num")
    public int getFollowNum() {
        return followNum;
    }

    public void setFollowNum(int followNum) {
        this.followNum = followNum;
    }

    @Column(name = "total_num")
    public int getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(int totalNum) {
        this.totalNum = totalNum;
    }

    @Column(name = "repeated_status")
    public int getRepeatedStatus() {
        return repeatedStatus;
    }

    public void setRepeatedStatus(int repeatedStatus) {
        this.repeatedStatus = repeatedStatus;
    }

    @Column(name = "followed_status")
    public int getFollowedStatus() {
        return followedStatus;
    }

    public void setFollowedStatus(int followedStatus) {
        this.followedStatus = followedStatus;
    }

    @Column(name = "channel_tag")
    public String getChannelTag() {
        return channelTag;
    }

    public void setChannelTag(String channelTag) {
        this.channelTag = channelTag;
    }

    @Column(name = "copyright_end_time")
    public Long getCopyrightEndTime() {
        return copyrightEndTime;
    }


    public void setCopyrightEndTime(Long copyrightEndTime) {
        this.copyrightEndTime = copyrightEndTime;
    }

    @Column(name = "boss_status")
    public int getBossStatus() {
        return bossStatus;
    }

    public void setBossStatus(int bossStatus) {
        this.bossStatus = bossStatus;
    }

    @Column(name = "publish_status")
    public int getPublishStatus() {
        return publishStatus;
    }

    public void setPublishStatus(int publishStatus) {
        this.publishStatus = publishStatus;
    }

    @Column(name = "created_time", insertable = true, updatable = false)
    public Timestamp getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Timestamp createdTime) {
        this.createdTime = createdTime;
    }

    @Column(name = "op_user")
    public String getOpUser() {
        return opUser;
    }

    public void setOpUser(String opUser) {
        this.opUser = opUser;
    }

    @Column(name = "status")
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Column(name = "page_url")
    public String getPageUrl() {
        return pageUrl;
    }

    public void setPageUrl(String pageUrl) {
        this.pageUrl = pageUrl;
    }

    @Column(name = "extend_time")
    public Timestamp getExtendTime() {
        return extendTime;
    }

    public void setExtendTime(Timestamp extendTime) {
        this.extendTime = extendTime;
    }

    @Column(name = "actual_num")
    public int getActualNum() {
        return actualNum;
    }

    public void setActualNum(int actualNum) {
        this.actualNum = actualNum;
    }

    @Transient
    public boolean isNeedUpdate() {
        return needUpdate;
    }

    public void setNeedUpdate(boolean needUpdate) {
        this.needUpdate = needUpdate;
    }

    @Column(name = "last_created_no")
    public int getLastCreatedNo() {
        return lastCreatedNo;
    }

    public void setLastCreatedNo(int lastCreatedNo) {
        this.lastCreatedNo = lastCreatedNo;
    }

    @Column(name = "last_created_qipuid")
    public long getLastCreatedQipuId() {
        return lastCreatedQipuId;
    }

    public void setLastCreatedQipuId(long lastCreatedQipuId) {
        this.lastCreatedQipuId = lastCreatedQipuId;
    }

    @Column(name = "error_count")
    public int getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(int errorCount) {
        this.errorCount = errorCount;
    }

    public boolean checkIsFollow() {
        return this.followedStatus == FOLLOW_STATUS_YES.intValue();
    }

    public boolean checkIsRepeat() {
        return this.repeatedStatus == REPEAT_STATUS_YES.intValue();
    }
}
